package com.stp.yupao.model.enums;

import cn.hutool.core.util.EnumUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;

import java.util.Objects;

/**
 * 队伍状态枚举
 */
@Getter
@AllArgsConstructor
public enum TeamStatusEnum {

    PUBLIC(0, "公开"),
    PRIVATE(1, "私有"),
    SECRET(2, "加密");

    private int value;

    private String text;

    public static TeamStatusEnum getEnumByValue(Integer value) {
        if (value == null) {
            return null;
        }
        TeamStatusEnum teamStatusEnum = EnumUtil.getBy(TeamStatusEnum::getValue, value);
        if(Objects.nonNull(teamStatusEnum)){
            return teamStatusEnum;
        }
        return null;
    }
}
